#ifndef __IVY_BLOCK_H__
#define __IVY_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{
    // 常春藤
    class IvyBlock : public Block
    {
    public:
        static constexpr int32_t Index()
        {
            return 197;
        }
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

        virtual BlockPlacementData getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult) override;
        virtual const std::vector<BoundingBox> &getCustomCollisionBoxes(int32_t value) override;

        static inline int32_t GetFace(int32_t data);
        static inline int32_t SetFace(int32_t data, int32_t face);
        static inline bool IsGrowthStopCell(int32_t x, int32_t y, int32_t z);
    };

    int32_t IvyBlock::GetFace(int32_t data)
    {
        return data & 3;
    }

    int32_t IvyBlock::SetFace(int32_t data, int32_t face)
    {
        return (data & -4) | (face & 3);
    }

    bool IvyBlock::IsGrowthStopCell(int32_t x, int32_t y, int32_t z)
    {
        return MathUtils::Hash((uint32_t)(x + y * 451 + z * 77437)) % 5u == 0;
    }


} // namespace PocketSurvival

#endif
